# $Id: PKGBUILD 80469 2012-11-22 12:21:36Z spupykin $
# Maintainer: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributors:
#   Andrei Antoukh - niwi@niwi.be - http://www.niwi.be
#   henning mueller <henning@orgizm.net>

pkgname=glusterfs
_basever=3.3
pkgver=$_basever.1
pkgrel=1
pkgdesc='Is a cluster file-system capable of scaling to several peta-bytes.'
arch=(i686 x86_64)
url='http://www.gluster.org/'
license=(GPL2 LGPL3)
depends=(fuse python2 libxml2)
makedepends=(flex bison)
options=(!libtool)
source=(http://download.gluster.org/pub/gluster/glusterfs/$_basever/$pkgver/glusterfs-$pkgver.tar.gz
	glusterd.rc
	glusterd.service)
sha256sums=('19aaefe3a0f9059ae831b44c92944503cf439da82da23467101ac13da8b77519'
            'f8c113d2a101c93f0e899ba498d0cb6308caf02da37552f12245a863bec39ab4'
            'e9aa54fcff422e0266e0f89d4bda73e0c77458f7c5443b8327db1e7b4242e6f7')
sha256sums=('19aaefe3a0f9059ae831b44c92944503cf439da82da23467101ac13da8b77519'
            'f8c113d2a101c93f0e899ba498d0cb6308caf02da37552f12245a863bec39ab4'
            'e9aa54fcff422e0266e0f89d4bda73e0c77458f7c5443b8327db1e7b4242e6f7')

build() {
  cd $srcdir/$pkgname-$pkgver

  ./configure \
    --prefix=/usr \
    --sysconfdir=/etc \
    --localstatedir=/var \
    --mandir=/usr/share/man \
    --libexecdir=/usr/lib/$pkgname \
    PYTHON=python2

  make

  sed -i s:env\ python:env\ python2: \
    xlators/features/marker/utils/syncdaemon/gsyncd.py
  sed -i s:/usr/bin/python:/usr/bin/python2: \
    contrib/ipaddr-py/ipaddr.py
}

package() {
  cd $srcdir/$pkgname-$pkgver

  mkdir -p $pkgdir/usr/sbin
  make DESTDIR=$pkgdir install
  mv $pkgdir/sbin/* $pkgdir/usr/sbin
  rmdir $pkgdir/sbin

  install -D -m 644 \
    $srcdir/$pkgname-$pkgver/{README,INSTALL,COPYING*} \
    $pkgdir/usr/share/doc/glusterfs/

  install -D -m 755 \
    $srcdir/glusterd.rc \
    $pkgdir/etc/rc.d/glusterd

  install -D -m 644 \
    $srcdir/glusterd.service \
    $pkgdir/usr/lib/systemd/system/glusterd.service

  cp -rf \
    $srcdir/$pkgname-$pkgver/doc/* \
    $pkgdir/usr/share/doc/glusterfs/
}

# vim:set ts=2 sw=2 et:
